public class Singletontest01{

    static {
        System.out.println("该设计模式为饿汉式-静态常量实现! ");
    }
    public static void main(String[] args) throws Exception{
        Singletion instance= Singletion.getInstance();
        Singletion instance2=Singletion.getInstance();
        System.out.println(instance==instance2);
        System.out.println(instance.hashCode());
        System.out.println(instance2.hashCode());
    }
}
class Singletion{
    private Singletion(){}
    private final static Singletion instance=new Singletion();
    public static Singletion getInstance(){
        return instance;
    }
}
